let isClear = false

export function start(execFunc, millisecond) {
  if (!execFunc || !millisecond) return 

  const next = () => {
    setTimeout(()=>{
      if (!isClear) execFunc(next)
    }, millisecond)
  }

  setTimeout(()=>{ execFunc(next) }, 0)
}

export function clear() {
  isClear = true
}